//
//  BaseNavigationController.m
//  Stream
//
//  Created by shaw on 16/7/28.
//  Copyright © 2016年 showshaw. All rights reserved.
//

#import "BaseNavigationController.h"

@interface BaseNavigationController ()

@end

@implementation BaseNavigationController


-(void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    UIViewController * vc = [self.viewControllers lastObject];
    vc.navigationItem.backBarButtonItem = [self setupBarButton];
    
    [super pushViewController:viewController animated:YES];
}

-(UIBarButtonItem*)setupBarButton
{
    UIBarButtonItem * barItem = [[UIBarButtonItem alloc] init];
    
    barItem.title = @"";
    
    UIImage* backImage = [UIImage imageNamed:@"return_icon"];
    
    [barItem setBackButtonBackgroundImage:[backImage resizableImageWithCapInsets:UIEdgeInsetsMake(0, backImage.size.width -2 , 0, 1)]
                                 forState:UIControlStateNormal
                               barMetrics:UIBarMetricsDefault];
    
    return barItem;
}
@end
